package com.sxz.sbs.module.order.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.module.order.mode.OrderhandleBean;
import com.sxz.sbs.module.order.view.OrderListView;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;

/**
 * 订单列表P层
 * @author hp
 */
public class OrderListPresenter extends RxPresenter<OrderListView>{
    /**
     * @param map
     */
    public void getOrderList (final HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getOrderList(map)
                .compose(RxUtil.<OrderhandleBean>handleResult())
                .subscribeWith(new RxSubscriber<OrderhandleBean>(mView){
                    @Override
                    public void onNext(OrderhandleBean data) {
                        mView.onOrderListSuccess(data);
                    }
                })
        );
    }
}
